home *** CD-ROM | disk | FTP | other *** search
- /*
- File: Sprocket.h
-
- Contains: Prototypes for the “guts” of a Macintosh application.
-
- Written by: Dave Falkenburg
-
- Copyright: © 1993-1994 by Dave Falkenburg, all rights reserved.
-
- Change History (most recent first):
-
- <6> 11/12/94 DRF AppConditionals.h is now BuildConditionals.h. Also revised some
- QuickDrawGX stuff.
- <5> 11/8/94 DRF Add prototype for DragDestinationIsTheTrash.
- <4> 9/27/94 DRF Changed filename to Sprocket.h. Also made scrap coercion
- routines more explicit.
- <3> 9/9/94 DRF Reordered headers and removed redundant #includes.
- <2> 9/4/94 DRF Added scroll bar constants.
- */
-
- #ifndef _SPROCKET_
- #define _SPROCKET_
-
- #ifndef _BUILDCONDITIONALS_
- #include "BuildConditionals.h"
- #endif
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
-
- #ifndef __WINDOWS__
- #include <Windows.h>
- #endif
-
- #ifndef __DIALOGS__
- #include <Dialogs.h>
- #endif
-
- #ifndef __STANDARDFILE__
- #include <StandardFile.h> // for ModalFilterYDUPP
- #endif
-
- #ifndef __DRAG__
- #include <Drag.h>
- #endif
-
- #include "Preferences.h"
- #include "Window.h"
-
- #if qUseQuickDrawGX
- #include <FixMath.h> // make sure we don’t use GX lame #define of “fixed1”
- #include <graphics types.h>
- #endif
-
- // useful macros
-
- #if qDebug
- #define DebugMessage(x) DebugStr(x)
- #else
- #define DebugMessage(x)
- #endif
-
- // Resource IDs
-
- #define kErrorAlertID 128
- #define kStandardCloseAlertID 129
- #define kStandardCloseWithNewPubsAlertID 130
-
- #define kCoreErrorStrings 128
- #define kUnsupportedSystemSoftware 1
- #define kNeedsThreadManager 2
- #define kNeedsQuickdrawGX 3
-
- #define kStandardCloseStrings 129
- #define kQuittingStr 1
- #define kClosingStr 2
-
- #define kPreferencesFileStrings 130
- #define kPreferencesFileName 1
-
- #define kSplashPictureID 128
-
- #if qUseQuickDrawGX
- #define kUseGraphicsSizeResource 0
- #define kAllowGXToExtendGraphicsHeap ((gxClientAttribute) 0)
- #endif
-
- // Useful constants
-
- enum
- {
- kScrollbarWidth = 16, // width of a standard Macintosh scrollbar
- kScrollbarTweak = 2 // left edge = rightedge - kScrollbarWidth + kScrollbarTweak
- };
-
- // Useful functions provided by App:
-
- void HandleEvent(EventRecord *anEvent);
- void HandleClose(WindowPtr aWindow);
-
- short StandardAlert( short alertID,
- short defaultItem = ok,
- short cancelItem = 0,
- ModalFilterUPP customFilterProc = nil);
-
- void ErrorAlert(short stringList,short whichString);
- void FatalErrorAlert(short stringList,short whichString);
-
- extern ModalFilterUPP StandardDialogFilter;
- extern ModalFilterYDUPP StandardDialogFilterYD;
- extern void PseudoClickInDialogItem(DialogPtr theDialog, short itemToClick);
-
- enum StandardCloseResult
- {
- kSaveDocument = 1,
- kCancelSaveDocument = 2,
- kDontSaveDocument = 3
- };
-
- StandardCloseResult StandardCloseDocument(const StringPtr documentType,StringPtr documentName, Boolean hasNewEditions, Boolean quitting);
-
- OSErr CheckAppleEventForMissingParams(AppleEvent *theAppleEvent);
-
- short OpenPreferencesResFile(void);
-
- Boolean DragDestinationIsTheTrash(DragReference theDrag);
-
-
- // AOCE “FrontWindow”-equivalent routine for the Standard Mail package
- extern FrontWindowUPP FrontWindowProcForAOCEUPP;
-
- // Globals
-
- extern Boolean gDone;
- extern Boolean gMenuBarNeedsUpdate;
-
- extern Boolean gHasColorQuickdraw;
- extern Boolean gHasThreadManager;
- extern Boolean gHasDragManager;
- extern Boolean gHasAOCE;
- extern Boolean gHasDisplayManager;
-
- #if qInlineInputAware
- extern Boolean gHasTextServices;
- extern Boolean gHasTSMTE;
- #endif
-
- #if qUseQuickDrawGX
- extern Boolean gHasQuickDrawGX;
- extern long gQuickDrawGXVersion;
- extern long gQuickDrawGXPrintingVersion;
- extern gxGraphicsClient gQuickDrawGXClient;
- #endif
-
- extern GrafPtr gWindowManagerPort;
- extern Rect gDeskRectangle;
- extern RgnHandle gMouseRegion;
-
- extern short gPreferencesRsrcRefNum;
-
-
- /////////////////////////////////////////////////////////////////
- //
- // Routines that the application MUST supply:
-
-
- // intialization & tear down
- extern OSErr SetupApplication(void);
- extern void TearDownApplication(void);
-
- // menu handling:
- extern void HandleMenu(TWindow * topWindowObj,long menuCode);
-
- // scrap coercion hooks:
- extern void WriteLocalClipboardToScrap(void);
- extern void ReadLocalClipboardFromScrap(void);
-
- // document handling routines:
- extern OSErr CreateNewDocument(void);
- extern OSErr OpenDocument(LetterDescriptor *,void *);
- extern OSErr PrintDocument(LetterDescriptor *,void *);
- extern Boolean QuitApplication(void);
-
- #endif
-